package com.youkeda.test.j3.c2;

import com.alibaba.fastjson.JSON;

import java.util.Map;

/**
 * @author xshuai
 */
public class ObjectAssembler {
    public static void main(String[] args) {
        Apartment apartment = new Apartment();
        apartment.setName("研究生公寓");
        apartment.setAddress("杭州市江干区学林街628号");
        apartment.setTotalRooms(54);
        apartment.setBuildtupArea("380平米");
        String content = JSON.toJSONString(apartment);
        Apartment apartment1 = JSON.parseObject(content, Apartment.class);
        System.out.println(apartment1.getName());
        Map map = JSON.parseObject(content, Map.class);
        System.out.println(map.get("name"));
    }
}
